<%@ page import="org.ljx.taobao.dao.impl.ShoppingDaoImpl" %>
<%@ page import="org.ljx.taobao.controller.ClearServlet" %>
<%@ page import="org.ljx.taobao.api.entity.Shopping" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>购物车</title>
</head>
<body>
<c:if test="${!empty shopList}">
    ${aa}
<table align="center" width="800" border="1" style="border-collapse: collapse">
    <tr>
        <th>商品名称</th>
        <th>商品信息</th>
        <th>商品价格</th>
        <th>商品数量</th>
        <th>选择服务</th>
    </tr>
    <c:forEach items="${shopList}" var="shop1">
    <tr>
        <td>${shop1.name}</td>
        <td>${shop1.information}</td>
        <td>${shop1.price}</td>
        <td>${shop1.num}</td>
        <td>
            <form action="increase" method="post">
                <input type="hidden" value="${shop1.id}" name="id">
                <button>+</button>
            </form>
            <form action="delete" method="post">
                <input type="hidden" value="${shop1.id}" name="id">
                <button>删除订单</button>
            </form>
            <form action="decrease" method="post">
                <input type="hidden" value="${shop1.id}" name="id">
                <button>-</button>
            </form>
        </td>
    </tr>
    </c:forEach>
    </c:if>
    <h1>
        总价格为 ：<%
        out.println(ShoppingDaoImpl.x);
        ShoppingDaoImpl.x = 0;
    %>
    </h1>
    <form action="commodity.jsp" method="post">
        <button>继续购物</button>
    </form>
    <form action="clear" method="post">
        <button>清空订单</button>
    </form>
    <form action="login.jsp" method="post">
        <button>退出登录</button>
    </form>
        <%
    if (ClearServlet.x){
        out.print("<script>alert(\"清除成功\")</script>");
        ClearServlet.x=false;
    }
%>
</body>
</html>
